//判断cook是否登录
// function ck(key){
//     var ckl=document.cookie
//     console.log(ckl)
//     var arr=ckl.split('; ')
//     for(var i=0;i<arr.length;i++){
//         var zhong1=arr[i].split('=')
//         if(zhong1[0]==key){
//              var deng1=document.getElementById('deng1')
//              deng1.innerHTML="欢迎"+zhong1[1]
//         }
//     }
// }
//ck('name')
if(getcook('name')){
    var deng1=document.getElementById('deng1')
    var dengs=getcook('name')
    deng1.innerHTML="欢迎"+dengs
}

function lun1(){
	var som=0
	dsq1=setInterval(()=>{
	som++
	if(som>4){
		$('.toulun').css('top',-35)
		som=2
	}
	$('.toulun').animate({top:-som*35},500)
},2000)
}
lun1()

var dao1=document.querySelector('.daobox')
window.onscroll=function(){
	let gun1=window.pageYOffset
	
	if(gun1>100){
		dao1.style.position='fixed'
		dao1.style.borderBottom='3px solid #000'
		dao1.style.zIndex='5'
	}else{
		dao1.style.position=''
		dao1.style.border=''
		dao1.style.zIndex=''
	}
}
//鼠标移入事件
var boy1=document.body
var $xian1=$('.shou12_yi>:nth-child(2)')
var yi1=document.querySelector('.shou12>:nth-child(1)')
var yi2=document.querySelector('.shou12>:nth-child(2)')
yi1.onmousemove=function(){
	$('.shou12_yi>:nth-child(1)').css({display:'block',zIndex:8})
}
yi1.onmouseout=function(){
	$('.shou12_yi>:nth-child(1)').css({display:'none'})
}

// 移入2
yi2.onmousemove=function(){
	$('.shou12_yi>:nth-child(2)').css({display:'block'})
}
yi2.onmouseout=function(){

		$('.shou12_yi>:nth-child(2)').css({display:'none'})

}
var yi22=document.querySelector('.shou12_yi>:nth-child(2)')
yi22.onmouseenter=function(){
	yi22.style.display='block'
}
yi22.onmouseleave=function(){
	yi22.style.display='none'
}
//放大镜
var sha1=document.querySelector('.lf-2')
sha1.onmousemove=function(e){
    var e=e || window.event
    // var dian=e.target || e.srcElement
    
    //鼠标获取移动的距离
    var lef1=e.pageX-sha1.offsetLeft
    var wi1=e.pageY-sha1.offsetTop
    if(lef1>=500){
        lef1=500
    }else if(lef1<=0){
        lef1=0
    }else{
        lef1=lef1*-2
    }
    if(wi1>=500){
        wi1=500
    }else if(wi1<=0){
        wi1=0
    }else{
        wi1=wi1*-2
    }
    $('.lf-2 img').css({height:1000,width:1000,left:lef1/2,top:wi1/2})
    //图片移动距离
    
   //console.log(wi1)
}
sha1.onmouseleave=function(e){
    var e=e || window.event
    $('.lf-2 img').css({height:500,width:500,top:0,left:0})
}

//点击事件切换图片
var qie1=document.querySelectorAll('.lf-1>ul>li')
for(let i=0;i<qie1.length;i++){
    qie1[i].onclick=function(){
        var imgs=qie1[i].lastElementChild.getAttribute('src')
        sha1.lastElementChild.setAttribute('src',imgs)
    }
}